package com.zesionlee.server.result


class Result<T>(
    val code: Int = 200,
    val data: T? = null,
    val msg: String? = null

) {

    companion object {

        fun <T> success(data: T, msg: String = "success"): Result<T> {
            return Result<T>(200, data, msg)
        }

        fun successMsg(msg: String): Result<Unit> {
            return Result<Unit>(200, null, msg)
        }

        fun error(msg: String, code: Int = 500): Result<Unit> {
            return Result(code, null, msg)
        }

    }


}